package com.wudu.gTorchat;

import java.awt.Component;
import java.awt.Image;

import javax.swing.DefaultListCellRenderer;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

public class Contact extends JLabel {

   public static enum Status {
      online, away, extendedAway, offline
   };

   private static ImageIcon iconOnline = new ImageIcon("icons/online.png");
   private static ImageIcon iconOffline = new ImageIcon("icons/offline.png");
   private static ImageIcon iconAway = new ImageIcon("icons/away.png");
   private static ImageIcon iconExtendedAway = new ImageIcon("icons/xa.png");
   
   private String name;
   private String address;
   private String description;
   private Status status;
   private ImageIcon currentStatusIcon;
   

   public Contact(String name, String address, String description, Status status) {
      this.name = name;
      this.address = address;
      this.description = description;
      setStatus(status);
   }

   public void setStatus(Status status){
      switch(status){
      case online:
         currentStatusIcon = iconOnline;
         break;
      case offline:
         currentStatusIcon = iconOffline;
         break;
      case away:
         currentStatusIcon = iconAway;
         break;
      case extendedAway:
         currentStatusIcon = iconExtendedAway;
         break;
      }
      this.status = status;
   }
   
   public String getName(){
      return name;
   }
   
   public ImageIcon getIcon(){
      return currentStatusIcon;
   }

}
